﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test.ConApp
{
    class Program
    {
        static void Main(string[] args)
        {
            RsaService.RsaServiceSoapClient client
                = new RsaService.RsaServiceSoapClient();


            Console.WriteLine("测试第一阶段：生成");
            String PK=String.Empty;
            String RsaId = String.Empty;

            try
            {
                RsaId = client.GeneralKey("", out PK);
                Console.WriteLine("测试结果：" + RsaId.ToString());
                Console.WriteLine("第一阶段测试成功。");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                Console.WriteLine("第一阶段测试失败。");
            }

            Console.WriteLine("测试第二阶段：加密");

            try
            {
                client.Encrypt(RsaId, PK, "TEst1123581321", "");
                Console.WriteLine("第二阶段测试成功。");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                Console.WriteLine("第二阶段测试失败。");
            }

            Console.WriteLine("测试第三阶段：解密");

            try
            {
                Console.WriteLine(client.DecryptByRsaId(RsaId));
                Console.WriteLine("第三阶段测试成功。");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                Console.WriteLine("第三阶段测试失败。");
            }
        }
    }
}
